"""
URL configuration for djangomyerp project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.conf import settings
from django.conf.urls.static import static
from base.views import print,reportDesign,reportDesignPost,printNow,reportCreate,printSimpleData,reportAltName
from ckeditor_uploader import views as ckeditor_views
from django.views.decorators.cache import never_cache
from django.contrib.admindocs import urls as admindocs_urls
from website import urls as website_urls
from search import urls as search_urls
from base import urls as base_urls
from store import urls as store_urls
from django.views.generic import RedirectView
urlpatterns = [
    path('', RedirectView.as_view(url='/website', permanent=True)),
    path('admin/doc/', include(admindocs_urls)),  # 文档访问路径
    path('admin/', admin.site.urls),
    path('report/design/', reportDesign, name='report_design'),
    path('report/create/', reportCreate, name='report_create'),
    path('report/design/post', reportDesignPost, name='report_design_post'),
    path('print/simpledate/', printSimpleData),
    path('print/altername/', reportAltName),
    path('print/now', printNow),

    path('print/', print),

   path('ckeditor/upload/', never_cache(ckeditor_views.upload), name='ckeditor_upload'),
    path('ckeditor/browse/', never_cache(ckeditor_views.browse), name='ckeditor_browse'),
    path('website/', include(website_urls)),  # 文档访问路径
    path('search/', include(search_urls)),  # 文档访问路径
    path('base/', include(base_urls)),  # 文档访问路径
    path('store/', include(store_urls)),  # 文档访问路径


]
# 在开发环境下提供媒体文件访问
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

    import debug_toolbar
    urlpatterns += [ path('__debug__/', include(debug_toolbar.urls)), ]